<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
	#div1 {width: 400px; height: 300px; background: red; display: none;}	
</style>
<script>
	window.onload = function()
	{
			var oBtn = document.getElementById('btn1');
		 var oDiv = document.getElementById('div1');
		
		 oBtn.onclick = function(ev)
			{
				 oDiv.style.display = 'block';
					
					//alert('按钮被点击了');
				 var oEvent = ev || event;
					oEvent.cancelBubble = true;
			};
			
			document.onclick = function()
			{
				 oDiv.style.display = 'none';
					//alert('ducument被点击了');
			};
	}
	</script>
</head>

<body>
<input type="button" id="btn1" value="显示">
<div id="div1">
	
</div>
</body>
</html>
